package com.ds.smartstudio.controller;

import com.alibaba.fastjson.JSON;
import com.ds.smartstudio.entity.Type;
import com.ds.smartstudio.service.TypeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yangsf
 * @since 2022-07-02 10:42:24
 */
@RestController
@RequestMapping("/smartstudio/type")
public class TypeController {
    @Autowired
    TypeService typeService;

    @ApiOperation("type实体")
    @RequestMapping(method = RequestMethod.HEAD)
    public Type type() {
        return new Type();
    }

    @ApiOperation("该方法用于获取所有的设备类型")
    @GetMapping
    public String selectAll() {
        List<Type> types = typeService.list();
        return JSON.toJSONString(types);
    }


}
